package edu.hhu.controller;

import java.util.Arrays;
import java.util.List;

import com.jfinal.core.Controller;

import edu.hhu.chart.service.ChartDataService;

public class ChartController extends Controller {

	public void showChart() {

		List<String> fields = Arrays.asList(this.getPara("fieldStr").split(","));
		List<String> legend = Arrays.asList(this.getPara("nodeStr").split(","));
		String level = this.getPara("level");
		String chartType = this.getPara("chartType");
		String chartStyle = this.getPara("chartStyle");
		ChartDataService chartDataService = new ChartDataService();
		
		String json = chartDataService.getChartJson(fields, legend, level, chartType, chartStyle);
//		System.out.println(json);
		
		renderJson(json);
	}
}
